

% 根据调度方案绘制甘特图
clc;
clear;  
 A= [1	1	1	1	0	43
2	1	1	1	43	71
3	1	1	1	71	111
4	1	1	1	111	139
5	1	1	1	139	188
6	1	1	1	188	239
7	1	1	1	239	288
8	1	1	1	288	324
9	1	2	2	43	89.625
10	1	2	2	89.625	117.625
11	1	2	2	117.625	159.625
12	1	2	2	159.625	182.625
13	1	2	2	188	245
14	1	2	2	245	291
15	1	2	2	291	352
16	1	2	2	352	393
17	2	1	3	89.625	138.875
18	2	1	3	138.875	160.875
19	2	1	3	160.875	212.875
20	2	1	3	212.875	244.875
21	2	1	3	245	304
22	2	1	3	304	353
23	2	1	3	353	412
24	3	1	3	412	460
25	3	1	4	138.875	190.875
26	3	1	4	190.875	226.875
27	3	1	4	226.875	271.875
28	3	1	4	271.875	305.875
29	3	1	4	305.875	359.875
30	3	1	4	359.875	410.875
31	3	1	4	412	457
32	3	1	4	460	485.75
]
schedule=A
figure;
Job=max(schedule(:,1));
Machinedis=max(schedule(:,2));
ylim([0 5]);
row=size(schedule,1);
%eachcolors=[0 0.80784 0.81961];
 eachcolors1=[0.74118 0.71765 0.41961];
%eachcolors2=[0 0.80784 0.81961];
for i=1:row
    X=[schedule(i,5) schedule(i,6)];
    now=schedule(i,4)
    Y=[now now]
 %  line(X,Y,'LineWidth',30,'color',eachcolors);
  line(X,Y,'LineWidth',25,'color',[0.8500 0.3250 0.0980])
end
for i=1:row
     X=[schedule(i,6) schedule(i,7)];
    now=schedule(i,4)
     Y=[now now]
%line(X,Y,'LineWidth',25,'color',eachcolors1);
line(X,Y,'LineWidth',25,'color',[0.9290 0.6940 0.1250])
end 
for i=1:row
     X=[schedule(i,7) schedule(i,8)];
    now=schedule(i,4)
     Y=[now now]
%	line(X,Y,'LineWidth',30,'color',eachcolors2);
line(X,Y,'LineWidth',25,'color',[0 0.4470 0.7410])
end 
for  i=1:row
    X=schedule(i,6:7)
txt=[num2str(schedule(i,1))];
   now=schedule(i,4)
text( mean(X), now,txt,"FontName","Times New Roman","FontSize",15,"LineWidth",20)
end
yticks(1:4);
ytickTxt=cell(1,4);
ytickTxt(1)={['M' num2str(1) '-' num2str(1)] };
ytickTxt(2)={['M' num2str(1) '-' num2str(2)] };
ytickTxt(3)={['M' num2str(2)] }% '-' num2str(1)] };
ytickTxt(4)={['M' num2str(3) ] }%'-' num2str(1)] };
yticklabels( ytickTxt);
%title('The Scheduling Result')
%xlabel('Processing Time')
%ylabel('Processing Machine')
title('切割调度结果')
xlabel('加工时间')
ylabel('加工机器')